package com.volunteer.controller;

import com.volunteer.common.R;
import com.volunteer.common.Result;
import com.volunteer.model.vo.HomeDataVO;
import com.volunteer.service.HomeService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

/**
 * 首页控制器
 */
@RestController
@RequestMapping("/home")
@RequiredArgsConstructor
public class HomeController {

    private final HomeService homeService;

    /**
     * 获取首页数据
     *
     * @return 首页数据（包含轮播图和热门活动）
     */
    @GetMapping("/data")
    public R<HomeDataVO> getHomeData() throws Exception {
        HomeDataVO homeData = homeService.getHomeData().get();
        return R.ok(homeData);
    }
}
